/*
   Copyright 2010 Bryce Alcock

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.com

 */

package com.ecocrypt.proxy.forwarder.remote;

import java.io.Serializable;

/**
 *  This class is used to translate command from the ForwardProxy to the Command Console.
 * All commands will be in the form of a string describing the command, and a payload.
 *
 * @author bryce
 */
public class Command implements Serializable {

    public static final String REMOVE_SERVICE_REQUEST = "RemoveServiceRequest";
    public static final String ADD_SERVICE_REQUEST = "AddServiceReqeust";
    public static final String UPDATE_SERVICE_REQUEST = "UpdateServiceReqeust";
   // An enhancement might be to use an enumeration.
    private String command;
    private Serializable payload;
    public Command(String c, Serializable p){
	command = c;
	payload =p;
    }

    /**
     * @return the command
     */
    public String getCommand() {
	return command;
    }

    /**
     * @return the payload
     */
    public Serializable getPayload() {
	return payload;
    }

    @Override
    public String toString() {
	StringBuilder sb = new StringBuilder();
	sb.append("Command: ").append(command);
	sb.append("\n payload->").append(payload);
	return sb.toString();
    }
}
